const config = {
	// API基础URL
	baseUrl: 'https://mx.119xfq.cn/mx',	
	mapKey: '5L4BZ-E3P3P-A2QDC-LFIK6-SR6JJ-XUFTX',
	// API端点
	api: {
		approvers: '/workflow/approval-workflow',
		// 请假相关接口
		leave: {
			apply: '/workflow/leave',
			list: '/workflow/leave/list',
			detail: '/workflow/leave/detail',
			cancel: '/workflow/leave/cancel',			
		},
		// 采购相关接口
		purchase: {
			apply: '/workflow/purchase',
			list: '/workflow/purchase/list',
			detail: '/workflow/purchase/detail',
			cancel: '/workflow/purchase/cancel',		
		},
		// 付款相关接口
		payment: {
			apply: '/workflow/payment',
			list: '/workflow/payment/list',
			detail: '/workflow/payment/detail',
			cancel: '/workflow/payment/cancel',		
		},
		// 用户相关接口
		user: {
			profile: '/user/profile',
			login: '/login',
			logout: '/user/logout',
			info: '/getUserInfo',
			updateAvatar: '/user/avatar',
			wxAuth: '/wx-auth'
		},
		// 文件上传接口
		upload: {
			file: '/upload/file'
		},
		// 工作流相关接口
		workflow: {
			myApplications: '/workflow/my-applications',
			pendingApprovals: '/workflow/pending-approvals',
			instance: (id: string) => `/workflow/workflow-instance/${id}`,
			approveAction: '/workflow/approval-action',		
			inventory: '/workflow/inventory',
			inventoryRecord: (workflowId: string) => `/workflow/inventory/${workflowId}`
		},
		// 考勤打卡相关接口
		attendance: {
			todayStatus: '/attendance/today',
			clockIn: '/attendance/clock-in',
			records: '/attendance/records',
			missedPunch: '/attendance/missed-punch',
			approvers: '/workflow/approval-workflow'
		},
		// 项目管理相关接口
		project: {
			list: '/project/list',
			detail: '/project/detail',
			updateLocation: '/project/update-location',
			location: '/project/location-by-ids'
		}
	},
	
	// 请求超时时间（毫秒）
	timeout: 10000,
	
	// 请求头配置smart redact 提示按钮点击X 没响应
	headers: {
		'Content-Type': 'application/json'
	}
}

// 获取完整的API URL
const getApiUrl = (endpoint: string): string => {
	console.log('getApiUrl', config.baseUrl + endpoint)
	return config.baseUrl + endpoint
}

// 导出配置
export default config
export { getApiUrl } 